package com.bruce.practice.lambda;

import java.util.function.Supplier;

/**
 * @author luotuan
 * @Description
 * @create 2020-11-18 21:54
 **/
public class DemoIntArray {
    public static void main(String[] args) {
        int[] array = {10, 20, 100, 30, 40, 50};
        printMax(() -> {
            int max = array[0];
            for (int i1 : array) {
                if (i1 > max) {
                    max = i1;
                }
            }
            return max;
        });
    }

    private static void printMax(Supplier<Integer> supplier) {
        int max = supplier.get();
        System.out.println(max);
    }
}
